<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8" />
		<title>编辑角色</title>
		<div th:replace="common/common_form_header"></div>
	</head>
<body>
	<div class="building-details" id="building-details">
	    <div class="layui-tab-content">
			<form id="defaultForm" action="#" th:action="@{/system/org/role/update}" th:method="post" >
				<input type="hidden" id="id" name="id" th:value="${orgrole.id}" >
				<div class="form-modal">
					<div class="form-wrap clearfix">
						<div class="col-md-6 col-sm-6 col-xs-6">
							<div class="form-group">
							    <label for="">角色名称</label>
							    <input type="text" class="form-control" id="roleName" name="roleName" class="form-control" th:value="${orgrole.roleName}"/>
							</div>
						</div>
						<div class="col-md-6 col-sm-6 col-xs-6">
							<div class="form-group">
							    <label for="">排序号</label>
							    <input type="text" name="sortNumber" id="sortNumber" class="form-control" placeholder="" th:value="${orgrole.sortNumber}">
							</div>
						</div>
						<div class="col-md-12 col-sm-12 col-xs-12">
							<div class="form-group">
							    <label for="">描述</label>
							    <textarea name="roleDesc" id="roleDesc" class="form-control" th:inline="text">[[${orgrole.roleDesc}]]</textarea>
							</div>
						</div>
						<div class="col-md-6 col-sm-6 col-xs-6">
							<button type="button" class="btn btn-default float-r" onclick="closeLayer()">取消</button>
						</div>	
						<div class="col-md-6 col-sm-6 col-xs-6">
							<button type="submit" class="btn btn-primary">保存</button>
						</div>	
						
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
<script type="text/javascript" th:inline="javascript">
$(document).ready(function() {
    $('#defaultForm')
        .bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
            	dicName: {
                    message: 'The dicName is not valid',
                    validators: {
                        notEmpty: {
                            message: 'The dicName is required and can\'t be empty'
                        }
                    }
                }
            }
        })
        .on('success.form.bv', function(e) {
            // Prevent form submission
            e.preventDefault();

            // Get the form instance
            var $form = $(e.target);

            // Get the BootstrapValidator instance
            var bv = $form.data('bootstrapValidator');

            // Use Ajax to submit form data
            $.post($form.attr('action'), $form.serialize(), function(result) {
				parent.layer.closeAll();
				parent.layer.msg(result.msg);
				parent.layui.table.reload('dg_role');
            }, 'json');
            //alert($form.attr('action'));
            
        });
});
</script>
</html>